home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-19 / mega211a.zip / HERC.C < prev    next >
Text File  |  1990-07-05  |  1KB  |  64 lines

  1.  
  2. /* HERC.C - (c) 1990 TommySoftware
  3.  
  4.    A sample program used for displaying prictures exported from
  5.    MegaPaint PC with the command "Export bitimage-Hercules"
  6.  
  7.    Notes:
  8.    - You must have a Borland's Turbo-C to compile this program.
  9.    - There should be a file called HERC.BGI supplied by Borland
  10.      in the current directory when you run this program.
  11.    - Program is called with one parameter which is the full name
  12.      of the 32k file exported from MegaPaint PC with the command
  13.      "Export bitimage-Hercules"
  14.  
  15. */
  16.  
  17.  
  18.  
  19. #include <stdio.h>
  20. #include <conio.h>
  21. #include <graphics.h>
  22.  
  23.  
  24. int main(int argc, char *argv[])
  25. {
  26.   int grdriver, grmode, err;
  27.   FILE *fp;
  28.   unsigned i;
  29.   char far *screen = (char far *)0xB0000000L;
  30.  
  31.   if (argc < 2) {
  32.     printf("File name required.\n");
  33.     return 1;
  34.   }
  35.  
  36.   grdriver = DETECT;
  37.   initgraph(&grdriver,&grmode,"");
  38.   err = graphresult();
  39.   if (err != grOk) {
  40.     printf("ERROR: %s\n", grapherrormsg(err));
  41.     return 2;
  42.   }
  43.   if (grdriver != HERCMONO) {
  44.     closegraph();
  45.     printf("You must have a hercules graphic adapter to run this program.\n");
  46.     return 3;
  47.   }
  48.  
  49.   fp = fopen(argv[1], "rb");
  50.   if (fp == NULL) {
  51.     closegraph();
  52.     printf("File '%s' not found.\n", argv[1]);
  53.     return 4;
  54.   }
  55.  
  56.   for (i=0; i<32768; i++) screen[i] = fgetc(fp);
  57.  
  58.   fclose(fp);
  59.   getch();
  60.   closegraph();
  61.  
  62.   return 0;
  63. }
  64.